﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Golos.Web.Utils;

namespace Golos.Web
{
    public partial class Site : System.Web.UI.MasterPage
    {
        //public Token token = null;

        protected void Page_Load(object sender, EventArgs e)
        {
            //Token token = TokenUtils.FromCookies(Request.Cookies);

            //if (token != null)
            //{
                //if (!token.IsValid())
                //{
                //    token.ValidTo = DateTime.Now.AddDays(Settings.ReadFromFile().TokenLifeTime);
                //    TokenUtils.ToCookies(Response.Cookies, token);
                //    LogClass.WriteDebugEntry("User: " + token.User + " продлил куку.");
                //}

                //HtmlGenericControl liSettings = new HtmlGenericControl("li");
                //liSettings.Attributes.Add("id", "liSettingsBtn");
                //HtmlGenericControl anchorSettings = new HtmlGenericControl("a");
                //anchorSettings.Attributes.Add("href", "/settings.aspx");
                //anchorSettings.Attributes.Add("id", "SettingsBtn");
                //anchorSettings.InnerHtml = "<span>Настройки</span>";
                //liSettings.Controls.Add(anchorSettings);
                //menuUl.Controls.Add(liSettings);

                //HtmlGenericControl liAbout = new HtmlGenericControl("li");
                //liAbout.Attributes.Add("id", "liAboutBtn");
                //HtmlGenericControl aAbout = new HtmlGenericControl("a");
                //aAbout.Attributes.Add("href", "/about.aspx");
                //aAbout.Attributes.Add("id", "AboutBtn");
                //aAbout.InnerHtml = "<span>Инфо</span>";
                //liAbout.Controls.Add(aAbout);
                //menuUl.Controls.Add(liAbout);

                //HtmlGenericControl liLogout = new HtmlGenericControl("li");
                //liLogout.Attributes.Add("id", "liLogoutBtn");
                //HtmlGenericControl aLogout = new HtmlGenericControl("a");
                //aLogout.Attributes.Add("id", "LogoutBtn");
                //aLogout.Attributes.Add("href", "javascript:void(0);");
                //aLogout.InnerHtml = "<span>Выйти</span>";
                //liLogout.Controls.Add(aLogout);
                //menuUl.Controls.Add(liLogout);
            //}
            //else
            //{
                //HtmlGenericControl liAbout = new HtmlGenericControl("li");
                //liAbout.Attributes.Add("id", "liAboutBtn");
                //HtmlGenericControl aAbout = new HtmlGenericControl("a");
                //aAbout.Attributes.Add("href", "/about.aspx");
                //aAbout.Attributes.Add("id", "AboutBtn");
                //aAbout.InnerHtml = "<span>Инфо</span>";
                //liAbout.Controls.Add(aAbout);
                //menuUl.Controls.Add(liAbout);

                //HtmlGenericControl liLogin2 = new HtmlGenericControl("li");
                //liLogin2.Attributes.Add("id", "liLoginBtn");
                //HtmlGenericControl aLogin2 = new HtmlGenericControl("a");
                //aLogin2.Attributes.Add("href", "#");
                //aLogin2.Attributes.Add("id", "LoginBtn");
                //aLogin2.InnerHtml = "<span>Войти</span>";
                //liLogin2.Controls.Add(aLogin2);

                //menuUl.Controls.Add(liLogin2);
            //}
        }
    }
}